<script setup lang="ts">
import { useUserStore } from '@/stores/user'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const user = useUserStore()

const formData = ref({
  username: '神龙教主',
  password: 'admin888',
})
const login = async () => {
  await user.getInfo(formData.value)
  router.push('/')
}
</script>

<template>
  <el-form>
    <el-form-item>
      <el-input
        placeholder="请输入用户名"
        v-model="formData.username"
      ></el-input>
    </el-form-item>
    <el-form-item>
      <el-input
        type="password"
        show-password
        placeholder="请输入密码"
        v-model="formData.password"
      ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button @click="login">登录</el-button>
    </el-form-item>
  </el-form>
</template>

<style scoped lang="scss">
.el-form {
  .el-button {
    width: 100%;
    height: 40px;
    background-color: #409eff;
    color: #fff;
  }
  .el-input {
    height: 40px;
  }
}
</style>
